<template>
<div>
	<el-dialog width="80%" top="1vh" title="查看征信报告" :visible.sync="dialogVisible" :close-on-click-modal="true">
		<h2>{{ initData.cert_name }}征信报告</h2>
		<!-- <br>
		<h3>征信分数：{{ Object.keys(this.initData).length ?initData.score  : ''}}</h3> -->
		<br>
		<el-descriptions title="规则是否通过" direction="vertical" :column="4" border>
			<el-descriptions-item label="征信风控分数">{{ Object.keys(this.initData).length ?initData.score: ''}}</el-descriptions-item>
			<el-descriptions-item label="风控结果一">{{ Object.keys(this.initData.rules).length ?initData.rules.p1==="AGREE"?"通过":"拒绝"  : ''}}</el-descriptions-item>
			<el-descriptions-item label="风控结果二">{{ Object.keys(this.initData.rules).length ?initData.rules.p2==="AGREE"?"通过":"拒绝"  : ''}}</el-descriptions-item>
			<el-descriptions-item label="风控结果三">{{ Object.keys(this.initData.rules).length ?initData.rules.p3==="AGREE"?"通过":"拒绝"  : ''}}</el-descriptions-item>
		</el-descriptions>
		<br>
		<el-descriptions title="⾮循环贷账户信息" direction="vertical" :column="5" border>
			<el-descriptions-item label="授权总额">{{ Object.keys(this.initData.labels).length ?initData.labels.c0001  : ''}}</el-descriptions-item>
			<el-descriptions-item label="账户数">{{ Object.keys(this.initData.labels).length ?initData.labels.c0002  : ''}}</el-descriptions-item>
			<el-descriptions-item label="机构数">{{ Object.keys(this.initData.labels).length ?initData.labels.c0003  : ''}}</el-descriptions-item>
			<el-descriptions-item label="最近6个⽉平均应还款 ">{{ Object.keys(this.initData.labels).length ?initData.labels.c0004  : ''}}</el-descriptions-item>
			<el-descriptions-item label="贷款余额 ">{{ Object.keys(this.initData.labels).length ?initData.labels.c0005  : ''}}</el-descriptions-item>
		</el-descriptions>
		<br>
		<el-descriptions title="循环贷账户信息" direction="vertical" :column="5" border>
			<el-descriptions-item label="授权总额">{{ Object.keys(this.initData.labels).length ?initData.labels.c0015  : ''}}</el-descriptions-item>
			<el-descriptions-item label="账户数">{{ Object.keys(this.initData.labels).length ?initData.labels.c0011  : ''}}</el-descriptions-item>
			<el-descriptions-item label="机构数">{{ Object.keys(this.initData.labels).length ?initData.labels.c0012  : ''}}</el-descriptions-item>
			<el-descriptions-item label="最近6个⽉平均应还款 ">{{ Object.keys(this.initData.labels).length ?initData.labels.c0013  : ''}}</el-descriptions-item>
			<el-descriptions-item label="贷款余额 ">{{ Object.keys(this.initData.labels).length ?initData.labels.c0014  : ''}}</el-descriptions-item>
		</el-descriptions>
		<br>
		<el-descriptions title="循环额度分账户信息" direction="vertical" :column="5" border>
			<el-descriptions-item label="授权总额">{{ Object.keys(this.initData.labels).length ?initData.labels.c0008  : ''}}</el-descriptions-item>
			<el-descriptions-item label="账户数">{{ Object.keys(this.initData.labels).length ?initData.labels.c0007  : ''}}</el-descriptions-item>
			<el-descriptions-item label="机构数">{{ Object.keys(this.initData.labels).length ?initData.labels.c0009  : ''}}</el-descriptions-item>
			<el-descriptions-item label="最近6个⽉平均应还款 ">{{ Object.keys(this.initData.labels).length ?initData.labels.c0006  : ''}}</el-descriptions-item>
			<el-descriptions-item label="未结清贷账户数  ">{{ Object.keys(this.initData.labels).length ?initData.labels.xs001  : ''}}</el-descriptions-item>
			<el-descriptions-item label="房贷账户数 ">{{ Object.keys(this.initData.labels).length ?initData.labels.xs002  : ''}}</el-descriptions-item>
			<el-descriptions-item label="未结清房贷账户总余额">{{ Object.keys(this.initData.labels).length ?initData.labels.xs003  : ''}}</el-descriptions-item>
			<el-descriptions-item label="除房贷以外未结清抵押/质押类贷款账户数 ">{{ Object.keys(this.initData.labels).length ?initData.labels.xs004  : ''}}</el-descriptions-item>
			<el-descriptions-item label="除房贷以外未结清抵押/质押类贷款余额">{{ Object.keys(this.initData.labels).length ?initData.labels.xs005  : ''}}</el-descriptions-item>
			<el-descriptions-item label="经营类贷款账户数 ">{{ Object.keys(this.initData.labels).length ?initData.labels.xs006  : ''}}</el-descriptions-item>
			<el-descriptions-item label="未结清经营类贷款账户余额 ">{{ Object.keys(this.initData.labels).length ?initData.labels.xs007  : ''}}</el-descriptions-item>
			<el-descriptions-item label="近⼀个⽉要到期贷款账户数 ">{{ Object.keys(this.initData.labels).length ?initData.labels.xs008  : ''}}</el-descriptions-item>
			<el-descriptions-item label="近⼀个⽉要到期贷款账户余额">{{ Object.keys(this.initData.labels).length ?initData.labels.xs009  : ''}}</el-descriptions-item>
		</el-descriptions>
		<br>
		<el-descriptions title="贷记卡账户信息" direction="vertical" :column="3" border>
			<el-descriptions-item label="发卡机构数">{{ Object.keys(this.initData.labels).length ?initData.labels.c0022  : ''}}</el-descriptions-item>
			<el-descriptions-item label="账户数">{{ Object.keys(this.initData.labels).length ?initData.labels.c0023  : ''}}</el-descriptions-item>
			<el-descriptions-item label="授信总额">{{ Object.keys(this.initData.labels).length ?initData.labels.c0018  : ''}}</el-descriptions-item>
			<el-descriptions-item label="已使⽤额度">{{ Object.keys(this.initData.labels).length ?initData.labels.c0017  : ''}}</el-descriptions-item>
			<el-descriptions-item label="额度使⽤率（总）">{{ Object.keys(this.initData.labels).length ?initData.labels.xs010  : ''}}</el-descriptions-item>
			<el-descriptions-item label="额度使⽤率（单张最⾼） ">{{ Object.keys(this.initData.labels).length ?initData.labels.xs011  : ''}}</el-descriptions-item>
		</el-descriptions>
		<br>
		<el-descriptions title="对外担保" direction="vertical" :column="3" border>
			<el-descriptions-item label="是否存在对外担保">{{ Object.keys(this.initData.labels).length ?initData.labels.xs012  : ''}}</el-descriptions-item>
			<el-descriptions-item label="担保⾦额">{{ Object.keys(this.initData.labels).length ?initData.labels.xs013  : ''}}</el-descriptions-item>
			<el-descriptions-item label="剩余担保⾦额">{{ Object.keys(this.initData.labels).length ?initData.labels.xs014  : ''}}</el-descriptions-item>
		</el-descriptions>
		<br>
		<el-descriptions title="查询记录" direction="vertical" :column="3" border>
			<el-descriptions-item label="近⼀个⽉本⼈查询次数">{{ Object.keys(this.initData.labels).length ?initData.labels.a0017  : ''}}</el-descriptions-item>
			<el-descriptions-item label="近三个⽉贷款、信⽤卡、融资审批查询次数">{{ Object.keys(this.initData.labels).length ?initData.labels.j0022  : ''}}</el-descriptions-item>
			<el-descriptions-item label="近六个⽉贷款、信⽤卡、融资审批查询次数">{{ Object.keys(this.initData.labels).length ?initData.labels.j0021  : ''}}</el-descriptions-item>
		</el-descriptions>
		<br>
		<el-descriptions title="其他" direction="vertical" :column="2" border>
			<el-descriptions-item label="是否当前逾期">{{ Object.keys(this.initData.labels).length ?initData.labels.xs015  : ''}}</el-descriptions-item>
			<el-descriptions-item label="是否存在低保救助记录">{{ Object.keys(this.initData.labels).length ?initData.labels.xs016  : ''}}</el-descriptions-item>
		</el-descriptions>
	</el-dialog>
</div>
	
</template>

<script>
import { getCreditData } from "@/api/order";
export default {
	props: ['editItem'],
	data() {
		return {
			form: {
				orderId: '',
				cert_name: '', //真实姓名
				cert_no: '', //身份证号
				mobile: '', //手机号
			},
			initData: {
				cert_name: '',
				cert_no: '',
				mobile: '',
				labels:{},
				rules:{},
				score:'',
				model_type:''
			},
			dialogVisible: false
		}
	},
	methods: {
		getData() {
				this.initData.cert_name = this.form.cert_name;
				this.initData.cert_no = this.form.cert_no;
				this.initData.mobile = this.form.mobile;
				getCreditData(this.form).then(res => {
					this.initData.labels=res.resp_data.labels
					this.initData.rules=res.resp_data.rules
					this.initData.score=res.resp_data.score
					this.initData.model_type=res.resp_data.model_type
					console.log(res);
				});
		},
		init() {
			for (let key in this.form) {
				// this.form[key] = this.editItem[key].toString() || '';
				this.form[key] = this.editItem[key]
			}
		}
		
	},
	watch: {
		dialogVisible(val) {
				if (val) {
				this.init();
				this.getData();
			}
		}
	}
}
</script>

<style lang="scss" scoped>
.type_tip {
	color: #999999;
	line-height: 22px;

	span {
		color: #ff4146;
	}
}
</style>
